package com.graduation.springbootinit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.graduation.springbootinit.model.entity.ActivityPart.OutfitWorkLike;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OutfitWorkLikeMapper extends BaseMapper<OutfitWorkLike> {
    
    /**
     * 检查用户是否已点赞
     */
    @Select("SELECT COUNT(*) FROM community_activities_outfit_work_like WHERE work_id = #{workId} AND user_id = #{userId}")
    int checkUserLiked(@Param("workId") Long workId, @Param("userId") Long userId);
    
    /**
     * 获取作品的点赞数
     */
    @Select("SELECT COUNT(*) FROM community_activities_outfit_work_like WHERE work_id = #{workId}")
    int getLikeCount(@Param("workId") Long workId);
} 